package com.dant.utils
{
	public class ArrayIndexSelector
	{
		public function ArrayIndexSelector()
		{
		}

		public static function searchIndexInArray(valueToSearch:Object,propertyToSearchIn:String,array:Array):int
		{
			if ( array && array.length > 0 )
			{
				var n:int = array.length;
				for ( var i:int = 0; i<n; i++ )
				{
					var object:Object = array[i];
					if ( object.hasOwnProperty(propertyToSearchIn) && 
								object[propertyToSearchIn] == valueToSearch )
					{
						return (i);
					}
				}
			}
			
			return(-1);
		}

	}
}